package com.stox.shared.util;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

@Component
@Lazy(false)
public class ApplicationContextUtil implements InitializingBean {

	private static ApplicationContext instance;

	@Autowired
	private ApplicationContext applicationContext;

	@Override
	public void afterPropertiesSet() throws Exception {
		instance = applicationContext;
	}

	public static ApplicationContext getApplicationContext() {
		return instance;
	}

}
